<!--
 * @Descripttion: 
 * @version: 1.0
 * @Author: Sam
 * @Date: 2022-04-07 20:18:30
 * @LastEditors: Sam
 * @LastEditTime: 2022-05-05 23:49:24
-->
<template>
    <div class="app-container">
        <el-card>
            <div slot="header" class="clearfix">
                <span>签到列表</span>
            </div>
             <div class="filter-container">
                    <el-input v-model="listQuery.user" placeholder="请输入用户信息" clearable style="width: 200px;margin-right: 10px;margin-bottom:10px" class="filter-item" @keyup.enter.native="handleFilter" />

                <el-button v-waves  class="filter-item" type="primary" icon="el-icon-search" @click="handleFilter">
                {{ '搜索' }}
                </el-button>
            
                
                
            </div>
             <el-table
                v-loading="listLoading"
                :header-cell-style="{background:'#eef1f6',color:'#606266'}"
                :data="list"
                border
                fit
                highlight-current-row
                style="width: 100%"
                >  
        
            <el-table-column  align="center" label="头像">
                <template slot-scope="scope">
                    <el-image   :preview-src-list="scope.row.avatar ? scope.row.avatar.split(',') : []" style="width: 50px; height: 50px" :src="scope.row.avatar" fit="cover"></el-image>
                </template>
            </el-table-column>
            <el-table-column  align="center" label="昵称">
                <template slot-scope="scope">
                    <span>{{ scope.row.nickname }}</span>
                </template>
            </el-table-column>
      
            <el-table-column  align="center" label="签到时间">
                <template slot-scope="scope">
                    <span>{{ scope.row.create_time }}</span>
                </template>
            </el-table-column>
            </el-table>

            <pagination v-show="total>0" :total="total" :page.sync="listQuery.page" :limit.sync="listQuery.limit" @pagination="getList" />
        </el-card>
      

    </div>
</template>

<script>
    import waves from '@/directive/waves' // waves directive
    import permission from '@/directive/permission/index.js' // 权限判断指令
    import checkPermission from '@/utils/permission' // 权限判断函数
    import { list} from '@/api/sign' // api接口
    import { parseTime } from '@/utils' // 时间格式化函数
    import Pagination from '@/components/Pagination' // 分页组件
    export default{
        name: 'bannerIndex',
        components: { Pagination }, // 引入组件
        filters: {
            parseTime // 时间过滤器
        },
        directives: { waves, permission }, // 引入指令
          data() {
            return {
            list: null, // 列表数据
            total: 0, // 总条数
            listLoading: true, //加载loadig
            listQuery: { //列表查询参数
                page: 1,
                limit: 10
            },
           
          
       
            }
        },
          created() {
            this.getList()
        },
        methods: {
  
            checkPermission, // 权限判断函数
            handleFilter() { // 查询
                this.listQuery.page = 1
                this.getList()
            },
      
            getList() { // 获取列表
                this.listLoading = true
                list(this.listQuery).then(response => {
                        this.list = response.data.data
                        this.total = response.data.total
                        this.listLoading = false
                    })
                },
            }
    }
</script>

